]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Handle dropped app favorites
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 26 Jan 2021 10:33:54 +0000 (11:33 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 26 Jan 2021 10:36:34 +0000 (11:36 +0100)
Now that apps either appear in the dash or the app grid, it makes
sense to allow DND between the two components to add and remove
favorites.

Currently this only works for adding items to the dash, update the
app grid code to also accept drops from the dash.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1594>

js/ui/appDisplay.js

index c891de96650f93c2acba56d42dc19568a1506395..6abe25e9bf939e28eaa844a1fd93bf774f955161 100644 (file)
@@ -1325,7 +1325,8 @@ class AppDisplay extends BaseAppView {
         // exist in AppDisplay. We work around that by adding a placeholder
         // icon that is either destroyed on cancel, or becomes the effective
         // new icon when dropped.
-        if (_getViewFromIcon(source) instanceof FolderView)
+        if (_getViewFromIcon(source) instanceof FolderView ||
+            this._appFavorites.isFavorite(source.id))
             this._ensurePlaceholder(source);
     }
 
@@ -1363,6 +1364,9 @@ class AppDisplay extends BaseAppView {
         if (this._currentDialog)
             this._currentDialog.popdown();
 
+        if (this._appFavorites.isFavorite(source.id))
+            this._appFavorites.removeFavorite(source.id);
+
         return true;
     }